package stream;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import java.util.stream.Stream;

public class StreamTeat {
    public static void main(String[] args) {

        ArrayList<String> manList = new ArrayList<>();
        manList.add("华生");
        manList.add("说华生");
        manList.add("苏华生");
        manList.add("五华生");
        manList.add("家华生");
        manList.add("周华生");
        ArrayList<String> womenList = new ArrayList<>();
        womenList.add("呀华发");
        womenList.add("的华发");
        womenList.add("的d发");
        womenList.add("是华发");
        womenList.add("你华发");
        womenList.add("爱华发");

        //得到男演员三个字的前三人
        Stream<String> man = manList.stream().filter(s -> s.length() == 3).limit(3);

        List<String> strings = man.toList();

        for (String s : strings) {
            System.out.println(s);
        }
        //women 的
        Stream<String> women = womenList.stream().filter(s -> s.startsWith("的")).skip(1);

        Stream<String> concat = Stream.concat(man, women);

        concat.map(s -> new Actor(s)).forEach( p -> System.out.println(p.getName()));



    }
}
